import com.google.jplurk.*
import java.util.Date
import java.lang.management.RuntimeMXBean
import java.lang.management.ManagementFactory

words = ['uptime']

words.each {
		word ->

		if (plurk.content.toLowerCase().indexOf(word) >= 0) {
				println "match ${word}"

				RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();

				l1 = new Date(mx.getStartTime()).time
				l2 = new Date().time

				secondInMillis = 1000
				minuteInMillis = secondInMillis * 60
				hourInMillis = minuteInMillis * 60
				dayInMillis = hourInMillis * 24
				yearInMillis = dayInMillis * 365

				diff = l2 - l1
				elapsedHours = diff / hourInMillis

				uptime = "${elapsedHours} hours"

				ship.response plurk.plurk_id, uptime, Qualifier.SAYS
		}
}
